<template>
  <div style="height:100%;width:100%">
    <el-row class="mainContent" >
      <!--工具条-->
      <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
        <el-form :inline="true"  :model="filters" size="small" style="text-align:left;" ref="filters">
          <el-form-item prop="id">
            <el-input v-model="filters.usercode" placeholder="登录名" clearable></el-input>
          </el-form-item>
          <el-form-item>
            <div class="block">
              <el-date-picker
                v-model="filters.begtime"
                type="datetime"
                placeholder="选择日期">
              </el-date-picker>
              <el-date-picker
                v-model="filters.endtime"
                type="datetime"
                placeholder="选择日期">
              </el-date-picker>
            </div>
          </el-form-item>
          <el-form-item>
            <el-button type="primary"  @click="getUsers">查询</el-button>
          </el-form-item>
        </el-form>
      </el-col>
      <!--列表-->
      <el-table :data="users" highlight-current-row v-loading="listLoading" style="width: 100%;">
        <el-table-column prop="usercode" label="登录名"  >
        </el-table-column>
        <el-table-column prop="time" label="操作时间"  >
        </el-table-column>
        <!--<el-table-column prop="type" label="类型"  >-->
        <!--</el-table-column>-->
        <el-table-column prop="url" label="调用路径"  >
        </el-table-column>
        <el-table-column prop="descr" label="接口说明"  >
        </el-table-column>
        <el-table-column prop="params" label="操作数据"  >
        </el-table-column>
      </el-table>
      <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="limit"
                     :total="total" style="float:right;">
      </el-pagination>
    </el-row>

  </div>

</template>
<script>
  export default {
    data() {
      return {
        filters:{
          begtime:'',
          endtime:'',
          usercode:''
        },
        listLoading:false,
        limit:10,
        page:1,
        total:0,
        users:[]
      };
    },
    created() {
      this.filters.usercode = this.$route.query.code
      this.getUsers()
    },
    methods: {
      getUsers() {
        this.users = []
        this.listLoading = true;
        var obj = {
          data:{
            usercode:this.filters.usercode,
            begtime:this.filters.begtime==''||this.filters.begtime==0||this.filters.begtime==null?"":Date.parse(this.filters.begtime).toString().substr(0,10),
            endtime:this.filters.endtime==''||this.filters.endtime==0||this.filters.endtime==null?"":Date.parse(this.filters.endtime).toString().substr(0,10),
            pageNo:this.page
          }
        };
        this.$http('sys/log/list.do',obj).then(resp => {
          if(resp.code==1){
            this.users = resp.data.list;
            this.total = resp.data.total;
          }
          this.listLoading = false;
        });
      },
      handleCurrentChange(val) {
        this.page = val;
        this.getUsers();
      },
    }
  }
</script>

<style scoped>
  .el-input__inner{
    width: 180px !important;
  }
  .absoSpan{
    position: absolute;
    left: -11px;
  }
</style>
